package com.heima.admin.controller;


import com.heima.admin.service.AdminChannelService;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.dtos.WmChannelDto;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//@RestController
@RequestMapping("/api/v1/channel")
@Slf4j
public class AdminChannelController {
    @Autowired
    private AdminChannelService adminChannelService;
    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmChannelDto channelDto) {
        log.info("传入频道信息为：{}",channelDto);
        return adminChannelService.saveChannel(channelDto);
    }
    @PostMapping("/list")
    public ResponseResult pageQuery(@RequestBody WmChannelDto channelDto) {
        log.info("传入分页搜索信息为：{}", channelDto);
        return adminChannelService.pageQuery(channelDto);
    }
    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody WmChannelDto channelDto){
        log.info("传入预修改的频道信息为：{}",channelDto);
        return adminChannelService.update(channelDto);
    }

    @GetMapping("/del/{id}")
    public ResponseResult deleteChannel(@PathVariable Integer id){
        log.info("传入预删除的频道id为： {}",id);
        return adminChannelService.deleteChannel(id);
    }

}
